package jp.ac.aiit.spg.dao;

import java.util.List;

import jp.ac.aiit.spg.common.SpgAssignStatus;
import jp.ac.aiit.spg.entity.*;

public interface SpgTaskDao {

	// Basic Operations 
	SpgTask find(Integer id);
	SpgTask getReference(Integer id);
	void persist(SpgTask sm);
	void remove(SpgTask sm);
	SpgTask merge(SpgTask sm);
	void refresh(SpgTask sm);
	void readLock(SpgTask sm);
	void writeLock(SpgTask sm);
	
	// Additional Operations
	List<SpgTask> findAll();
	List<SpgTask> findByProject(Integer wbs$id, String[] orderBy);
	List<SpgTask> findByProjectAndAssignStatus(Integer wbs$id, SpgAssignStatus assignment, String orderBy);
	List<SpgTask> findByUserTasksAndAssignStatus(Integer todo$id, SpgAssignStatus assignment, String[] orderBy);	
	SpgTask getByProjectAndWbsNumber(Integer wbs$id, String wbsNumber);

	
	// 機能テスト
	List<SpgTask> findByName(String name);
	
	// これは動かない。 SQL上で "member" が構文エラーになる。
	List<SpgTask> findByProjectAndMemberAndAssignedStatus(Integer wbs$id, Integer member$id, SpgAssignStatus assignment, String orderBy);

	// これは動く
	List<SpgTask> findByProjectAndMember(Integer wbs$id, SpgMember member, String orderBy);
	List<SpgTask> findByProjectAndMemberAndAssignedStatus(Integer wbs$id, SpgMember member, SpgAssignStatus assignment, String orderBy);
	
	
}
